import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.close();

        List<Integer> sequence = new ArrayList<>();

        int current = n;
        while (current != 1) {
            sequence.add(current);
            if (current % 2 == 0) {
                current = current / 2;
            } else {
                current = current * 3 + 1;
            }
        }
        sequence.add(1);

        for (int i = sequence.size() - 1; i >= 0; i--) {
            System.out.print(sequence.get(i));
            if (i > 0) {
                System.out.print(" ");
            }
        }
    }
}